﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Model;

namespace View
{
    /// <summary>
    /// Interaction logic for TiempoDeVidaPass.xaml
    /// </summary>
    public partial class TiempoDeVidaPass : Window
    {
        public TiempoDeVidaPass()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                VidaDelPass vidaPass = new VidaDelPass();
                vidaPass.TiempoSemanas = Convert.ToInt32(comboBox1.Text);
                vidaPass = DataAccess.AccessoADatos.insertarPas(vidaPass);
                
                if (vidaPass != null)
                {
                    MessageBox.Show("Se modifico correctamente el tiempo", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    this.Close();
                }
            }
            catch
            {
                MessageBox.Show("Error al guardar el tiempo");
            }
        }
    }
}
